<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"	
	xmlns:rich="http://richfaces.org/rich"
	xmlns:p="http://primefaces.org/ui"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:c="http://java.sun.com/jsp/jstl/core" >
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</h:head>
<h:body>
<ui:composition template="template.xhtml">

	<ui:define name="title">mehmet emmy</ui:define>
	<ui:define name="body">
	

<h:form id="formAdres" prependId="false" >    	                  
                    
		<c:set var="illl" value="#{adresBean.currentAdres.il}"></c:set>
     	<c:if test="illl=='Mersin'">
	     	<h:outputText value="#{adresBean.currentAdres.ilce}" />
     	</c:if>
    <p:dataTable id="adres" var="adr" value="#{adresBean.adresList}" rowKey="#{adr.tckimlik}"  
                 selection="#{adresBean.currentAdres}" selectionMode="single">  
  
        <f:facet name="header">  
            Click "View" button after selecting a row to see details  
        </f:facet>  
  
        <p:column headerText="Id" style="width:125px">  
            #{adr.tckimlik}  
        </p:column>  
  		
        <p:column headerText="il" style="width:125px">
         <p:cellEditor>  
         		<f:facet name="output">  
                    <h:outputText value="#{adr.il}" />  
                </f:facet>  
                <f:facet name="input">  
                    <p:inputText value="#{adr.il}" style="width:100%"/>
                </f:facet>              
            </p:cellEditor>
        </p:column>  
  		
        <p:column headerText="ilce" style="width:125px">             
            <p:cellEditor>  
         		<f:facet name="output">  
                    <h:outputText value="#{adr.ilce}" />  
                </f:facet>  
                <f:facet name="input">  
                    <p:inputText value="#{adr.ilce}" style="width:100%"/>
                </f:facet>              
            </p:cellEditor>
        </p:column>  
  
        <p:column headerText="mahalle" style="width:125px">  
      		<p:cellEditor>  
         		<f:facet name="output">  
                    <h:outputText value="#{adr.mahalle}" />  
                </f:facet>  
                <f:facet name="input">  
                    <p:inputText value="#{adr.mahalle}" style="width:100%"/>
                </f:facet>              
            </p:cellEditor>             
        </p:column>  
  
        <f:facet name="footer">  
            <p:commandButton id="viewButton" value="View" icon="ui-icon-search"  
                    update=":formAdres:adresDisplay" oncomplete="indadrDialog.show()"/>  
        </f:facet>
        
        <f:facet name="footer">  
            <h:commandButton id="gitButton" value="Git" icon="ui-icon-search"  
                    action="#{adresBean.viewDetail }" style="width:65px"/>
        </f:facet>               
        
     
        <f:facet name="footer">  
            <p:commandButton id="saveButton" value="save" icon="ui-icon-search"  
                    oncomplete="confirmation.show()"/>   
        </f:facet> 
  		 <p:column headerText="Options" style="width:50px">  
            <p:rowEditor/>  
        </p:column> 
  
    </p:dataTable>  
	  
    <p:dialog id="adresDialog" header="Adres Detail" widgetVar="indadrDialog"  
              width="200" showEffect="clip" hideEffect="fold" minimizable="true">  
  
        <h:panelGrid id="adresDisplay" columns="2" cellpadding="4">  
  
            <f:facet name="header">                  
                  <p:graphicImage value="/productImages/lcdtvd.jpg" style="height: 150px; width: 140px"/>
            </f:facet>  
  
            <h:outputText value="Tc Kimlik:" />  
            <h:outputText value="#{adresBean.currentAdres.tckimlik }" />  
  
            <h:outputText value="il:" />  
            <h:outputText value="#{adresBean.currentAdres.il }" />  
           	
            <h:outputText value="ilce:" />  
            <h:outputText value="#{adresBean.currentAdres.ilce }" />  
  
            <h:outputText value="mahalle:" />  
            <h:outputText value="#{adresBean.currentAdres.mahalle }" />  
                
            <p:commandButton id="saveButton" value="Save" icon="ui-icon-search"  
                    oncomplete="confirmation.show()"/>                                         
        </h:panelGrid> 
    </p:dialog>     
     <p:growl id="messages" showDetail="true" />  
     <h:outputText id="msg" value=" "/> 
     <p:confirmDialog id="onay" message="Are you sure?"  
                header="Initiating save process" severity="alert" widgetVar="confirmation">  
                  
        <p:commandButton id="confirm" value="Yes Sure" update="messages" 
        	oncomplete="indadrDialog.hide():confirmation.hide()"  
                    actionListener="#{adresBean.destroyWorld}" />  
        <p:commandButton id="decline" value="Not Yet" onclick="confirmation.hide()" type="button" />   
                  
    </p:confirmDialog>
</h:form>  
	</ui:define>	
</ui:composition>
</h:body>
</html>